﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using API.EntityObject;
using ThangNM_LIB.DB;
using ThangNM_LIB.FUNC;

namespace API.DataAccessObject
{
    public class KaraokeDAO : MSSqlDataProvider
    {
        public override Boolean bWriteLog { get { return false; } set { } }
        public override String sConnectionStrings { get { return ConstEx.connectionStrings.connMSSql_API; } set { } }
        public KaraokeDAO(Boolean _bWriteLog = false, String _sConnectionStrings = ConstEx.connectionStrings.connMSSql_API)
        {
            this.bWriteLog = _bWriteLog;
            this.sConnectionStrings = _sConnectionStrings;
        }

        public List<KaraokeEO> SelectList_ByKey(String sKeyword)
        {
            List<KaraokeEO> lstRet = new List<KaraokeEO>();
            SqlCommand cmd = new SqlCommand("API_KARA_SelectList_ByKey");
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@sKeyword", sKeyword));
            DataTable dt = GetDataTable(cmd);
            if (DataTableEx.DataTable_OK(dt))
                lstRet = (List<KaraokeEO>)ConvertEx.ConvertDataTableToListObject<KaraokeEO>(dt, lstRet.GetType());
            return lstRet;
        }
    }
}